<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div></div>
<div></div>
<div></div>
<script>
    const array = ['hello', 'world', 'test', 'good'];
    // ... 扩展运算符,能将[数组]转换为逗号分隔的参数序列
    console.log([...array].map(i => i.toUpperCase()));

    function show() {
        console.log(arguments)
    }

    //这样调用,arguments中只有一个参数,包含了4个元素
    show(array)
    //使用扩展运算符,那么arguments中有4个参数,相当于全部打散了
    show(...array)


    //应用 . 合并数组

    const people = ['tony', 'tom', 'kiki']
    const pets = ['cat', 'dog', 'bird']

    //es5
    // const strings = people.concat(pets);

    //扩展运算符合并数组
    const res = [...people, ...pets];
    console.log(res);

    //数组的克隆 (浅拷贝)
    const sss = ['a', 'b', 'c']
    const aaa = [...sss]

    //伪数组转为真数组
    const divs = document.querySelectorAll("div");
    const divArr = [...divs]
    console.log(divArr)

</script>
</body>
</html>
